<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <title>登录</title>
    <script src="/js/jquery.min.js"></script>
</head>
<body>
    <div>
        <form action="/user/login" method="post" onsubmit="return login()">
            <table>
                <tr>
                    <th colspan="2">登录</th>
                </tr>
                <tr>
                    <td>账号</td><td><input type="text" id="idNumber" placeholder="手机号或邮箱" name="username" /></td>
                </tr>
                <tr>
                    <td>密码</td><td><input type="password" id="password" name="password" /></td>
                </tr>
                <tr>
                    <td colspan="2"><span th:text="${msg}"></span></td>
                </tr>
                <tr>
                    <td><input type="submit" value="登录"  /></td>
                    <td><input type="reset" onclick="reg()" value="注册"  /></td>
                </tr>
            </table>
        </form>
    </div>
    <script>

        function login() {
            var idNumber = $("#idNumber").val().trim();
            var password = $("#password").val().trim();
            if (idNumber == "") {

                alert("请输入账号");
                return false;
            }
            if (password == "") {
                alert("请输入密码");
                return false;
            }
            return true;
        }
        function reg() {
            location.href = "http://localhost:8080/toReg";
        }


    </script>
</body>
</html>